﻿using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.UI;
using Soveryn.Commerce.API;
using Soveryn.Commerce.BaseClasses;

namespace Soveryn.Commerce.Pages
{
    public partial class OrderDetailsReceiptEmail : PageBaseClass
    {

        protected new void Page_PreInit(object sender, EventArgs e)
        {
            Website = WebsiteData.WebsiteDetail();
            GetCustomer();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            OrderDetailsControl.OrderID = Request.QueryString["OrderID"];

        }

        protected void Page_Init(object sender, EventArgs e)
        {
            this.EnableViewState = false;
        }

        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter hWriter = new HtmlTextWriter(sw);
            base.Render(hWriter);
            string html = sb.ToString();
            html = Regex.Replace(html, "<input[^>]*>", string.Empty, RegexOptions.IgnoreCase);
            html = Regex.Replace(html, "<form[^>]*>", string.Empty, RegexOptions.IgnoreCase);
            html = Regex.Replace(html, "</form>", string.Empty, RegexOptions.IgnoreCase);
            html = Regex.Replace(html, "<div class=\"aspNetHidden\">(.|\n)*?</div>", string.Empty, RegexOptions.IgnoreCase);


            writer.Write(html);
        }

    }
}